#include<bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c,d;
  int tc;cin>>tc;
  while(tc--) {
    cin>>a>>b>>c>>d;
    cout<<max(a+b, c+d)<<'\n';
  }
}
